<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>demo</title>
  <script type="text/javascript" src="../vue.js"></script>
</head>

<body>
  <div id="app">
    <h1>计数</h1>
    <p>数值:{{count}}</p>
    <button @click="ellipsis">简写方式</button>
    <button v-on:click="add">累加</button>
    <button v-on:click="cut">累加</button>
    <button v-on:click="addN(5)">累加</button>
    <button v-on:click="cutN(5)">累加</button>
    <button v-on:click="handleDom">捕获事件对象1</button>
    <button v-on:click="handleDom('如果使用括号调用可以通过$event修饰符捕获事件',$event)">捕获事件对象2</button>
    <!-- <button v-on:click="cutN(5)">累加</button> -->
  </div>
</body>
<script type="text/javascript">
  Vue.config.productionTip = false;
  const vm = new Vue({
    el: "#app",
    data() {
      return {
        count: 0
      }
    },
    methods: {
      add() {
        this.count++
      },
      cut() {
        this.count--
      },
      addN(five) {
        this.count+=five
      },
      cutN(five) {
        this.count-=five
      },
      ellipsis(){
        console.log('简写'); 
      },
      handleDom(e) {
        console.log('e', e);
        console.log(e.target,"dom元素");
      },
      // handleDom(_,e) {
      //   console.log(e,"事件");
      // }
    }
  })
</script>

</html>